import Vue from 'vue';
import axios from 'axios';
import vuex from 'vuex';
Vue.use(vuex);
var store = new vuex.Store({
    state: {
        isShowMenu: false,
        path: {
            now: '/',
            before: '',
            to: '',
            aniType: '',
            // 是否是一级页面
            count: true
        },
        allHotel: '',
        oneHotel:'',
        hotels:''
    },
    mutations: {
        setIsShowMenu: function (state, data) {
            state.isShowMenu = data;
        },
        setPath: function (state, data) {
            state.path = data;
        },
        setAllHotel: function (state, data) {
            state.allHotel = data;
        },
        setOneHotel: function (state, data) {
            state.oneHotel = data;
        },
        setHotels: function (state, data) {
            state.hotels = data;
        },
    },
    actions: {
        queryAH: function (context, pramas) {
            return new Promise(function (resolve, reject) {
                axios.post("/hotel/allHotel", pramas).then(res => {
                    resolve(res);
                });
            })
        },
        queryOneHotel: function (context, pramas) {
            return new Promise(function (resolve, reject) {
                axios.post("/hotel/oneMsg", pramas).then(res => {
                    resolve(res);
                });
            })
        },
    }
});
export default store;